namespace Brjnk.GpxExplorer.Workspace.Searching
{
    using System;
    using System.ComponentModel;
    using System.Windows.Media;
    using Brjnk.GpxExplorer.ViewModel;
    using Brjnk.MVVM;

    /// <summary>
    /// </summary>
    public abstract class SearchRequest : INotifyPropertyChanged, ISearchResults
    {
        private bool searchInGaps;

        public bool SearchInGaps
        {
            get { return searchInGaps; }
            set { searchInGaps = value; OnPropertyChanged("SearchInGaps"); }
        }

        private Color color1;

        public Color Color1
        {
            get { return color1; }
            set { color1 = value; OnPropertyChanged("Color1"); }
        }

        private Color color2;

        public Color Color2
        {
            get { return color2; }
            set { color2 = value; OnPropertyChanged("Color2"); }
        }

        private string stringRepresentation;

        public string StringRepresentation
        {
            get { return stringRepresentation; }
            protected set { stringRepresentation = value; OnPropertyChanged("StringRepresentation"); }
        }

        public event PropertyChangedEventHandler PropertyChanged;

        protected void OnPropertyChanged(string propertyName)
        {
            if (PropertyChanged != null) PropertyChanged(this, new PropertyChangedEventArgs(propertyName));
        }

        public ObservableCollectionEx<SearchResult> SearchResults { get; set; }

        public event EventHandler Changed;

        protected void OnChanged()
        {
            if (Changed != null) Changed(this, EventArgs.Empty);
        }
    }
}